<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子12-JS进阶（二）</title>
    </head>
    <body class="cols">
        <pre>
            <code>
                    // 例子12

                    foo();

                    function foo() {}; // function形式声明

                    bar(); // 报错

                    var bar = function() {}; // var形式的表达式声明，即函数表达式
            </code>
        </pre>
        <pre>
            <code>
                    function foo() {};

                    var bar = undefined;

                    foo();

                    bar(); // 这里bar还未赋值，报错

                    bar = function(){};
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/12.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>